<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script src="http://mockjs.com/dist/mock.js"></script>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>  
  <script>
    axios.request({
      method: 'GET',
      url: 'https://cdn.liyanhui.com/data.json'
    }).then(res => {
      console.log(res.data)
    })

    // mock 拦截
    // 地址需要保持一致, 模拟的时候尽可能保证数据格式的一致性
    Mock.mock('https://cdn.liyanhui.com/data.json', {
      'list|5-10': [{
        'id|+1': 1,
        'username': '@cname',
        'email': '@email',
        'gender': '@boolean',
        'price': '@integer'
      }]
    });
  </script>
</body>
</html>